package com.baosight.risk.service.quartz.impl;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baosight.risk.api.quartz.ISysJobParamService;
import com.baosight.risk.base.mapper.BaseMapper;
import com.baosight.risk.base.service.BaseServiceImpl;
import com.baosight.risk.common.bean.BeanUtils;
import com.baosight.risk.mapper.quartz.SysJobParamMapper;
import com.baosight.risk.service.quartz.entity.SysJobParam;
@Service
public class SysJobParamServiceImpl extends BaseServiceImpl<SysJobParam> implements ISysJobParamService {

    @Autowired
    private SysJobParamMapper sysJobParamMapper;

    @Override
    public BaseMapper getMapper() {
        return sysJobParamMapper;
    }

	@Override
	public int save(SysJobParam jobParam) {
		if(StringUtils.isBlank(jobParam.getId())){
			jobParam = (SysJobParam) BeanUtils.initBean(jobParam);
			return this.insert(jobParam);
		}else{
			return this.update(jobParam);
		}
	}

	@Override
	public int deleteById(String id) {
		// TODO Auto-generated method stub
		return sysJobParamMapper.deleteByPrimaryKey(id);
	}

	@Override
	public SysJobParam queryManageCompConfig(String jobGuid) {
		SysJobParam param = new SysJobParam();
		param.setJobGuid(jobGuid);
		param.setParamCode("manageCompCode");
		return sysJobParamMapper.selectOne(param);
	}

}
